package com.charonmc.commands;

import com.charonmc.parkour.ParkourManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class SetPoint implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
        if (sender instanceof Player && sender.hasPermission("Hub.SetPoint")){
            Player player = (Player) sender;
            if (args.length != 1){
                sender.sendMessage("§c§l参数错误!");
                sender.sendMessage("§b§l/setpoint start/end");
            } else {
                if ("start".equals(args[0])){
                    sender.sendMessage("§b§l你正在设置本端跑酷§a§l起点。");
                    sender.sendMessage("§b§l请破坏一个铁踏板。");
                    ParkourManager.adminSet.put(player, 1);

                } else if ("end".equals(args[0])){
                    sender.sendMessage("§b§l你正在设置本端跑酷§a§l终点。");
                    sender.sendMessage("§b§l请破坏一个铁踏板。");
                    ParkourManager.adminSet.put(player, 2);
                }
            }
        }
        return true;
    }
}
